1. Field of the Invention
This invention relates generally to the field of data networks. More particularly, the invention relates to an improved system and method for collecting and evaluating statistics to establish network connections.
2. Description of the Related Art
FIG. 1 illustrates a prior art computing device 101 communicatively coupled to a plurality of Local Area Networks (LANs) 120-121 through different communication interfaces en_1 110 and en_0 111. Examples of such local area networks include IEEE 802.3-based networks (Ethernet networks), IEEE 802.11-based networks (e.g., also referred to as “WiFi” networks), and wireless cellular data networks (e.g., such as GPRS or 3G networks). For example, communication interface en_1 110 may be an Ethernet interface for communicating to local hosts 656 over an Ethernet network 120 and communication interface en_0 111 may be an 802.11n WiFi interface for communicating with local hosts 655 over an 802.11n network 121. “Local” in this context refers to the fact that hosts 655 and 656 are connected to the same LAN as computing device 101. Current devices such as the iPhone (designed by the assignee of the present patent application), are equipped with additional interfaces such as Bluetooth interfaces and cellular data interfaces.
Gateway devices 611 and 612 are used to allow the computing device 101 to communicate with remote hosts 650-654 over a larger network 610 (e.g., the Internet) using a networking protocol such as TCP/IP. As illustrated, each of the remote hosts 650-654 may be associated with one or more subnets 125-127 coupled to the Internet through gateways 613-614. All computers that belong to a particular subnet are addressed with a common, identical, most-significant bit-group in their IP address, which is used to route packets across the network 610 to the gateway for that subnet. For example, if the gateway 614 of subnet 126 is identified by the IP address 10.0.1, then hosts 652 and 653 may be assigned IP addresses such as 10.0.1.26 and 10.0.1.5.
Certain hosts such as host 651 may be identified by multiple IP addresses and/or subnets. For example, host 651 may represent a large Internet site with multiple IP addresses associated therewith (e.g., such as Google.com or Yahoo.com). In operation, the computing device 101 may receive a list of the multiple IP addresses from a domain name service (DNS) server in response to a DNS query. The computing device 101 will then typically attempt to connect to the first IP address on this list.
As illustrated in FIG. 1, the computing device includes a networking engine 102 for implementing a network protocol stack. In order for the computing device 101 to communicate over the Internet 610, the network protocol stack must include support for the TCP/IP protocol. An application 105 wishing to communicate over the network 610 must do so by making calls to the networking engine 102.
On some computing devices 101, the networking engine 102 uses a routing table 103 for quickly determining an appropriate route to access a host at a particular IP address. As illustrated in FIG. 2, an exemplary routing table 103 may include a plurality of entries for each host address and/or subnet address 201. Associated with each host/subnet address is routing data 202 which specifies how to connect to a host with a particular IP address. For example, the routing data may identify the networking device (e.g., such as a gateway) to which TCP/IP packets should be transmitted to communicate with a particular host. By way of example, if host 653 has the IP address 167.78.89.12, then the networking engine 102 will identify this entry in the database and attempt to connect to host 653 using Host Routing Data E. In addition, as illustrated in FIG. 2, each entry in the routing table may be associated with one of the computing device's interfaces (en_1 and/or en_0).
If a specific IP address does not exist in the routing table 103 for a host, then the networking engine 102 will determine if routing data is available for the subnet of that host. Returning to the previous example, if host 653 has the IP address 167.78.89.17, then the networking engine 102 will “clone” Subnet Routing Data C for the 167.78.89 subnet and create a new entry in the routing table for host 653 with the “cloned” routing data.
If a routing table entry does not exist for the IP address or subnet address of a particular host, then the networking engine 102 will utilize a default entry for one of the communication interfaces en_1 310 or en_0 311 in the routing table 103 (illustrated in the final two rows in FIG. 2). For example, if the computing device 101 is currently connected to the Internet via interface en_1, then it may use Default Routing Data A to connect to the host. Similarly, if the computing device 101 is currently connected to the Internet via interface en_2, then it may use Default Routing Data A to connect to the host. Once the route to the host has been determined, the networking engine 102 may then update the routing table 103 to include a new routing entry for the host.
One limitation of current systems, however, is that when there are multiple possible routes to a particular host, no mechanism exists for choosing a route based on networking performance. For example, if host 651 is associated with multiple IP addresses which are returned to the computing device 101 via a DNS query, the networking engine 102 will typically just attempt to connect to the first IP address in the list returned by the DNS server (assuming that there are entries in the routing table for both addresses). Under these circumstances, it would be beneficial if the networking engine 102 had the ability to monitor networking performance for the different IP addresses and/or subnets and choose an IP address accordingly. Thus, what is needed is an improved technique for choosing the best route to a particular host.